<?php

  if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

  // -- webMS Modification --
  // Check if osCommerce environment is already loaded
  if (defined( '_OSCOMMERCE_LOADED' )) {
    if (!DB_SHARED) {
      // Reconnect to osCommerce Database
      tep_db_connect() or die('Unable to connect to database server!');
    }
    // Load osCommerce Globals for Boxes
    global $category_links, $languages_id, $catID, $catID_array, $current_category_id;
    global $request_type, $lng, $cart, $currencies, $language, $navigation, $breadcrumb;
  } else {
    // Load osCommerce Environment for the First Time
    require('components/'.$option.'/includes/application_top.php');
  }

// 	bof added by jobonline2001@yahoo.com for auction product contribution 
			  require(DIR_WS_LANGUAGES . $language . '/' . 'auctions.php');
			
				if (isset($_POST['placebid']) ) {
				
					$products_id = $_POST['products_id'];
					$bid_price = $_POST['bid_price'];
					$auction_id = $_POST['auction_id'];
					$bid_date = date("Y-m-d H:i:s", strtotime("NOW"));
					
					if ( tep_session_is_registered('customer_id') ) {
					
			
								$customers_id = (int)$customer_id;
										
								$sql_auction = 'select * from '.TABLE_AUCTIONS_BIDS ." where auctions_id='".						$auction_id."' and customers_id='$customers_id'";
								if (!tep_db_num_rows(tep_db_query($sql_auction)) ) {
								
										          $sql_auction = 'insert into '.TABLE_AUCTIONS_BIDS." (auctions_bids_id, auctions_id, customers_id, bid_price, bid_status, bid_date_added ) values('', '$auction_id', '$customers_id', '$bid_price', '', '$bid_date') ";
								
										tep_db_query($sql_auction);				
								} else { // auction existed 
								
									$exist_auction = tep_db_fetch_array(tep_db_query($sql_auction));
									if ( ($exist_auction['bid_status']!='won')&& ($exist_auction['bid_price']<$bid_price) ){
										
										$sql_auction = 'update '.TABLE_AUCTIONS_BIDS." set auctions_id='$auction_id',bid_price= '$bid_price', bid_date_added= '$bid_date' where auctions_id='$auction_id' and customers_id='$customers_id'";		
										tep_db_query($sql_auction);		
									} else {
										echo ' New price of bid must be more than your last bidding price!!';
									}
									
								}
								
			// send email notify about higher bid than the other customer's bid who won
								$sql_customer = 'select customers_lastname, customers_firstname,customers_email_address from '. TABLE_CUSTOMERS." c,". TABLE_AUCTIONS_BIDS." ab  where c.customers_id=ab.customers_id and ab.auctions_id= '$auction_id' and ab.bid_price<".(int)$bid_price." and ab.bid_status='won'";					
								$acustomer_query = tep_db_query($sql_customer);
								
								while ($acustomer = tep_db_fetch_array($acustomer_query)) {
									
									$acustomer_firstname = $acustomer['customer_firstname'];
									$acustomer_lastname = $acustomer['customers_lastname'];
									$acustomer_email = $acustomer['customers_email_address'];
									$acustomer_name = $customer_firstname .' '.$customer_lastname;
									$auction_url = tep_href_link(FILENAME_PRODUCT_INFO,'products_id='.$auction_id);
									
									$email_text = str_replace('[customer_firstname]',$acustomer_firstname,str_replace('[customer_lastname]',$acustomer_lastname,str_replace('[customer_email]',$acustomer_email,str_replace('[auction_name]',$auction_name,str_replace('[auction_url]',$auction_url,str_replace('[bid_price]',$bid_price,AUCTION_HIGHER_BID_NOTIFY_EMAIL))))));
							
									tep_mail($acustomer_name, $acustomer_email, AUCTION_HIGHER_BID_NOTIFY_EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
									
								}
								
								tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO,'products_id='.$products_id));
			
						} else {
								
			//					$navigation->set_snapshot();
								tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
						}				
				}
				
			// 	eof added by jobonline2001@yahoo.com for auction product contribution   
  require(DIR_WS_LANGUAGES . $language . '/' . $osMod . '.php');

     if(!tep_session_is_registered('sppc_customer_group_id')) { 
     $customer_group_id = '0';
     } else {
      $customer_group_id = $sppc_customer_group_id;
     }

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0");
	$product_check = tep_db_fetch_array($product_check_query);
   // EOF Separate Pricing Per Customer, hide products and categories from groups
?>
<?php 
//DANS AUCTION SCRIPT -REFRESH
$cquery="select products_id from ".TABLE_AUCTIONS_PRODUCTS." where products_id =".(int)$HTTP_GET_VARS['products_id'];
$cresult=tep_db_query($cquery);

$cnum=tep_db_num_rows($cresult);

$z=0;
while ($z < $cnum) {

$casprodid=mysql_result($cresult,$z,"products_id");

//echo $casprodid;
$z++;
}
if ($casprodid==(int)$HTTP_GET_VARS['products_id']) {
header('Refresh: 90');} else {
echo '';}
//END DANS AUCTION SCRIPT
?>
<script src="components/com_oscommerce/includes/enlarge.js" type="text/javascript"></script>
<script language="javascript">
<!--
  function popupWindow(url) {
    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=<?PHP Echo POP_WIN_WIDTH; ?>,height=<?PHP Echo POP_WIN_HIGHT; ?>,screenX=150,screenY=150,top=150,left=150');
  }
 /* DDB - 041031 - Form Field Progress Bar */
/***********************************************
* Form Field Progress Bar- By Ron Jonk- http://www.euronet.nl/~jonkr/
* Modified by Dynamic Drive for minor changes
* Script featured/ available at Dynamic Drive- http://www.dynamicdrive.com
* Please keep this notice intact
***********************************************/
function textCounter(field,counter,maxlimit,linecounter) {
	// text width//
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        
	// trim the extra text
	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	} else { 
	// progress bar percentage
	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
	// color correction on style from CCFFF -> CC0000
	setcolor(document.getElementById(counter),percentage,"background-color");
	}
}
function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
  
  function popupPricematch(url) {
  window.open(url,'popupPricematch','toolbar=no,status=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height400,screenX=10,screenY=150,top=10,left=150')
}
//-->
</script>

<!-- header //-->
<?php 
   
  if ($product_check['total'] < 1) {
  $hide_product = true; // needed for column_right

  
  
//keep from here start
$a['no_product'] = TEXT_PRODUCT_NOT_FOUND;
$a['continue_button'] =  '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>';
//keep from here end
  } else {

//cgs start check here
    $product_info_query = tep_db_query("select s.price_period, s.oneday_price, s.days_as_period, s.pay_period_type, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, NULL as specials_new_products_price, p.products_pdfupload, p.products_fileupload, p.products_vidupload, p.products_mp3, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id , p.affiliate_allow_product, p.products_length, p.products_width, p.products_depth from " . TABLE_PRODUCTS . " p, " . TABLE_SUBSCRIPTIONS ." s, " .TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_REQUEST['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' and s.productid = '" . (int)$_REQUEST['products_id'] . "'");
    $product_info = tep_db_fetch_array($product_info_query);
    

    if($product_info['products_name'] == '') {
    
     tep_db_query("INSERT IGNORE INTO `". TABLE_SUBSCRIPTIONS . "` values ('" . (int)$_REQUEST['products_id'] . "','Annually','0.0000','0.000','0','')");
     
     $product_info_query = tep_db_query("select s.price_period, s.oneday_price, s.days_as_period, s.pay_period_type, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, NULL as specials_new_products_price, p.products_pdfupload, p.products_fileupload, p.products_vidupload, p.products_mp3, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id , p.affiliate_allow_product, p.products_length, p.products_width, p.products_depth from " . TABLE_PRODUCTS . " p, " . TABLE_SUBSCRIPTIONS ." s, " .TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_REQUEST['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' and s.productid = '" . (int)$_REQUEST['products_id'] . "'");
    $product_info = tep_db_fetch_array($product_info_query);
    
    }
    

    
        if($product_info['products_quantity'] > 0 || GALLARY_QUOTE != 'true') {
     //echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
     $a['form'] =  tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
     } else {
     //echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_QUOTE));
     $a['form'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_QUOTE));
     }
if(!class_exists( 'JConfig' ) ) {     
     
global $_MAMBOTS;

$_MAMBOTS->loadBotGroup( 'content' );


$prodinfo = new stdClass(); 
$prodinfo->text = $product_info['products_description'];
$result = $_MAMBOTS->trigger( 'onPrepareContent' , array( 1, &$prodinfo, null, 0));
//echo $temp->text;
$a['prod_info'] = $prodinfo->text;
}else{
$a['prod_info'] = $product_info['products_description'];
}

$mainframe->appendMetaTag( 'keywords', $product_info['products_name'].', '.$product_info['products_model'] );
$mainframe->setPageTitle($product_info['products_name']);

    tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$_REQUEST['products_id'] . "' and language_id = '" . (int)$languages_id . "'");


    $auction_price = tep_get_products_auction_price($product_info['products_id']);
			$auction_product = false;
			if (!$auction_price) {
   $pf->loadProductSppc((int)$_GET['products_id'], (int)$languages_id, $product_info);
   $products_price = $pf->getPriceString();
   $products_price2 = $pf->getPriceStringShort();
   
   } else {
   
				$products_price	= $currencies->display_price($auction_price, 0);
				$products_price2 = $products_price;
				$auction_product = true;
			
				$sql_auction = 'select auctions_id from '.TABLE_AUCTIONS_PRODUCTS." where products_id='".$product_info['products_id']."'";
				$auction_info = tep_db_fetch_array(tep_db_query($sql_auction));
				$auction_id = $auction_info['auctions_id'];
				
				$databid = tep_db_query("select MAX(bid_price) as bid_price from ".TABLE_AUCTIONS_BIDS.' ab,'.TABLE_AUCTIONS_PRODUCTS.' ap where ab.auctions_id=ap.auctions_id and ab.auctions_id='.$auction_id.'');
				
				while($highbid = tep_db_fetch_array( $databid ))
if ($highbid['bid_price'] > 0){
//$products_price	= $currencies->display_price($highbid['bid_price'],0);
$products_price2 = TEXT_CURRENT_BID . $currencies->display_price($highbid['bid_price'],0);
$auction_curr = $highbid['bid_price'];
}
						
			}
   
    if (tep_not_null($product_info['products_model'])) {
      $products_name = $product_info['products_name'] . ' <span class="smallText">[' . $product_info['products_model'] . ']</span>';
    } else {
      $products_name = $product_info['products_name'];
    }
    
    
    
		  // START: Extra Fields Contribution v2.0b - mintpeel display fix
		  
                      $extra_fields_query = tep_db_query("
                      SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value
                      FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef
             LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf
            ON ptf.products_extra_fields_id=pef.products_extra_fields_id
            WHERE ptf.products_id=". (int)$_REQUEST['products_id'] ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
            ORDER BY products_extra_fields_order");

  while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
        if (! $extra_fields['status'])  // show only enabled extra field
           continue;
        $a['extrafields'] .= '
	  <table border="0" width="50%" cellspacing="0" cellpadding="2px"><tr>
      <td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>';
        $a['extrafields'] .= '<font size="1" color="#666666">' .$extra_fields['value'].'<BR></font> </tr>
      </table>
	  <br>'; 
  }
           
    if(tep_session_is_registered('wishlist_id'))
    { 
    $a['messagestack'] = PRODUCT_ADDED_TO_WISHLIST;  // keep

    tep_session_unregister('wishlist_id'); 
    }
    

    if (tep_not_null($product_info['products_image'])) {
	
		if (IMAGE_LIGHTBOX == 'true') {
			$a['jscript'] = '<a href="' . DIR_WS_IMAGES . $product_info['products_image'] . '" rel="lightbox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; 

			$a['image'] = '<a href="' . DIR_WS_IMAGES . $product_info['products_image'] . '" rel="lightbox['.$product_info['products_name'].']" title="'. $product_info['products_name'].'">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';

		} else {

//keep start
			$a['jscript'] = '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; 

			$a['image'] = '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';
//keep end
		}
				}
				
		$a['pdf'] = '';
		$a['file'] = '';
		$a['vid'] = '';
		$a['mp3'] = '';
		
		if (tep_not_null($product_info['products_pdfupload'])) {
		$a['pdf'] = '<br><a href="' . DIR_WS_IMAGES . '/' . $product_info['products_pdfupload'] . '" target="_BLANK">' .TEXT_CLICK_TO_PDFUPLOAD . '</a><br>';
		
		}
		if (tep_not_null($product_info['products_fileupload'])) {
		$a['file'] = '<br><a href="' . DIR_WS_IMAGES . '/' . $product_info['products_fileupload'] . '" target="_BLANK">' .TEXT_CLICK_TO_FILEUPLOAD . '</a><br>';
		
		}
		if (tep_not_null($product_info['products_mp3'])) {
		$a['mp3'] = "<br><a href=\"javascript:popupWindow('" .  tep_href_link('player.php' , 'popup=popup&type=1&track=' . $product_info['products_mp3'] . '&path=' . DIR_WS_IMAGES . '&title=' .  addslashes($product_info['products_name'])). "')\">" .tep_image_button('button_preview_mp3.gif', TEXT_CLICK_TO_MP3UPLOAD) . "</a>";
		
	
		}
		if (tep_not_null($product_info['products_vidupload'])) {
		$a['vid'] = '<br><a href="javascript:popupWindow(\'' .  tep_href_link('player.php' , 'popup=popup&type=2&track=' . $product_info['products_vidupload'] . '&path=' . DIR_WS_IMAGES). '\')">' .TEXT_CLICK_TO_VIDUPLOAD . '</a>';
		
		}
		
		
		

//affiliate build a link begin
		if (tep_session_is_registered('affiliate_id')) {
 
if ($product_info['affiliate_allow_product'] == 1) {
	     $a['affiliate'] = '<a href="' . tep_href_link(FILENAME_AFFILIATE_BANNERS_BUILD, 'individual_banner_id=' . $product_info['products_id']) .'" target="_self">' . tep_image_button('button_wishlist.gif', 'button_build_a_link.gif') . '</a>';
	     }
	     //tep_image('includes/languages/english/images/buttons/button_affiliate_build_a_link.gif', 'Make a link') . ' </a>';
		}

    //}
    // Points/Rewards system V2.00 BOF
    if ((USE_POINTS_SYSTEM == 'true') && (DISPLAY_POINTS_INFO == 'true')) { // check that the points system is enabled
      if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
        $products_price_points = tep_display_points($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
      } else {
        $products_price_points = tep_display_points($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
      }
      $products_points = tep_calc_products_price_points($products_price_points);
      $products_points_value = tep_calc_price_pvalue($products_points);
      if (USE_POINTS_FOR_SPECIALS == 'true' || $new_price == false){
        //echo '<p>' . sprintf(TEXT_PRODUCT_POINTS , number_format($products_points,POINTS_DECIMAL_PLACES), $currencies->format($products_points_value)) . '</p>';
        $a['points'] = sprintf(TEXT_PRODUCT_POINTS , number_format($products_points,POINTS_DECIMAL_PLACES), $currencies->format($products_points_value));
      } else {
          //echo '<p>' . TEXT_PRODUCT_NO_POINTS . '</p>';
          $a['points'] = TEXT_PRODUCT_NO_POINTS;
      }
    }
// Points/Rewards system V2.00 EOF

if (PRODUCT_LIST_DIMENSIONS) 
{
	if ($product_info['products_length'] !='' || $product_info['products_width'] !=null || $product_info['products_depth'] !=null ) {
  		//echo TEXT_PRODUCT_DIMENSIONS . ' ';
  		$a['prod_dimensions'] = TEXT_PRODUCT_DIMENSIONS;}
  	if (stripslashes($product_info['products_length']) != '')  {
  		//echo TEXT_PRODUCT_LENGTH . stripslashes($product_info['products_length']) . ' ';
  		$a['prod_dimensions'] .= TEXT_PRODUCT_LENGTH . stripslashes($product_info['products_length']) . ' ';
  		}
   	if (stripslashes($product_info['products_width']) != '') {  
  		//echo TEXT_PRODUCT_WIDTH . stripslashes($product_info['products_width']) . ' ';
  		$a['prod_dimensions'] .= TEXT_PRODUCT_WIDTH . stripslashes($product_info['products_width']) . ' ';
  		}
  	if (stripslashes($product_info['products_depth']) != '')  {
  		//echo TEXT_PRODUCT_DEPTH . stripslashes($product_info['products_depth']) . ' ';
  		$a['prod_dimensions'] .= TEXT_PRODUCT_DEPTH . stripslashes($product_info['products_depth']) . ' ';
  		}
}


    $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where approved = 1 and products_id = '" . (int)$_REQUEST['products_id'] . "'");
    $reviews = tep_db_fetch_array($reviews_query);
    if ($reviews['count'] > 0) {
 $a['reviews'] = TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; 
 
    }

    if (tep_not_null($product_info['products_url'])) {

$a['prod_url'] = sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, true)); 

    }

    if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {

 $a['date_details'] = sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); 
 
    } else {

 $a['date_details'] = sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); 
 
      }
      if (SHOW_PRICEMATCH == 'true') {
      
require(DIR_WS_LANGUAGES . $language . '/pricematch.php'); 
$this_Code = $product_info['products_model'];
$this_Product = $product_info['products_name'];
$this_Price = $product_info['products_price'];
 $a['pricematch'] = "<a href=\"javascript:popupPricematch('".$mosConfig_live_site."/index2.php?option=com_oscommerce&osMod=pricematch&code1=" . $this_Code . "&product1=" . $this_Product . "&price1=" . $this_Price . "')\">";
$a['pricematch'] .= PRICEMATCH_LINK . "</a>"; 
}
    
//print_r($navigation);
    $back = sizeof($navigation->path)-2;
    if (isset($navigation->path[$back])) {

$a['button_back'] = '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>';
    }else{
$a['button_back'] = '<a href="javascript:history.go(-1);">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>';    
    
    
    }
 $a['button_reviews'] = '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id='.(int)$_REQUEST['products_id']) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; 
 
     if (SHOW_WISHLIST == 'true') {

     if ($product_info['products_quantity'] > 0 || $product_info['products_quantity'] == 0 && GALLARY_QUOTE == 'false') {
     
     $a['button_wishlist'] = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_wishlist&products_id='.$product_info['products_id']) . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>';
     }
     }
     
     
                if (USE_AS_CATALOGUE != 'true'){
                 if($product_info['products_quantity'] > 0) {
                 
                  
                 $a['button_cart'] = TEXT_QUANTITY . tep_draw_input_field('quantity', $pf->adjustQty(1), 'SIZE=2 maxlength=2') . tep_draw_separator('pixel_trans.gif', '5', '1') .'<br>' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
                 
                 if(file_exists($mosConfig_absolute_path . '/components/com_giftreg/addtogift.php')){
                 include($mosConfig_absolute_path . '/components/com_giftreg/addtogift.php');
                 }
                 
                 }else {
                 $man_query = tep_db_query("select manufacturers_name from ".TABLE_MANUFACTURERS ." where manufacturers_id = '".$product_info['manufacturers_id']."'");
                 $man_array = tep_db_fetch_array($man_query);

                 if (GALLARY_QUOTE == 'true') {
                 $a['button_cart'] =tep_draw_hidden_field('manufacturer[0]', $man_array['manufacturers_name']) . 
                 tep_draw_hidden_field('model[0]', $product_info['products_model']) .
                 tep_draw_hidden_field('quantity[0]', '1') .
                 tep_draw_hidden_field('price[0]', $products_price) .
                 tep_image_submit('button_request_quote_info.gif', 'Request Quote');
                 }else
                 {
                 $a['button_cart'] = $a['button_cart'] = TEXT_QUANTITY . tep_draw_input_field('quantity', '1', 'SIZE=2 maxlength=2') . tep_draw_separator('pixel_trans.gif', '5', '1') .'<br>' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
                 if(file_exists($mosConfig_absolute_path . '/components/com_giftreg/addtogift.php')){
                 include($mosConfig_absolute_path . '/components/com_giftreg/addtogift.php');
                 }
                 }
                 }
                 }
  }

//  include(DIR_WS_MODULES . 'product_reviews_info.php');

  require(WS_TEMPLATES . E_TEMPLATE_FOLDER . '/'.$osMod.'.html');
?>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<?php 
      require(DIR_WS_INCLUDES . 'application_bottom.php');

  // -- webMS Modification --
  // reset the Mambo Database connection (stomped by osCommerce Connection)
  if (!DB_SHARED) {
    global $database, $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix;
    $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
  }
 ?>